﻿@{
    ViewBag.Title = "Home Page";
}

<main>
    <section class="row" aria-labelledby="aspnetTitle">
        <h1 id="title">ASP.NET</h1>
        <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
        <p><a href="https://asp.net" class="btn btn-primary btn-md">Learn more &raquo;</a></p>
    </section>

    <div class="row">
        <section class="col-md-4" aria-labelledby="gettingStartedTitle">
            <h2 id="gettingStartedTitle">Getting started</h2>
            <p>
                ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
                enables a clean separation of concerns and gives you full control over markup
                for enjoyable, agile development.
            </p>
            <p><a class="btn btn-outline-dark" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p>
        </section>
        <section class="col-md-4" aria-labelledby="librariesTitle">
            <h2 id="librariesTitle">Get more libraries</h2>
            <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
            <p><a class="btn btn-outline-dark" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p>
        </section>
        <section class="col-md-4" aria-labelledby="hostingTitle">
            <h2 id="hostingTitle">Web Hosting</h2>
            <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
            <p><a class="btn btn-outline-dark" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p>
        </section>

        <div class="form-group">
            <label>Session_id：</label><input id="session_id" class="form-control col-sm-10" />
        </div>
        <br />
        <div class="form-group">
            <label>Session_secret：</label><input id="session_secret" class="form-control" />
        </div>
        <br />
        <div class="form-group">
            <label>auth_code：</label><input id="auth_code" class="form-control" />
        </div>
        <br />
        <div class="form-group">
            <label>token：</label><input id="access_token" class="form-control" value="1748850869abddabbcabfcdcbdb84f61" />
        </div>
        <div class="form-group">
            <label>赵磊token：17387132399d882dd9b9939aaa0354cf</label>

        </div>
        <div class="form-group">
            <label>尹总token：1748850869abddabbcabfcdcbdb84f61</label>
        </div>
        <div class="form-group">
            <label>auth_data：</label>
            <textarea class="form-control" rows="3" id="authdata"></textarea>
        </div>
        <br />
        <div>
            <button onclick="Step1()">第一步</button>
        </div>
        <div>
            <input id="code" />
            <button onclick="Step2()">第二步</button>
        </div>
        <div>
            <button onclick="Step3()">获取用户账套列表</button>
        </div>
        <div>
            <button onclick="Step4()">第四步</button>
        </div>
        <div>
            <button onclick="Stepeee()">获取业务接口网关和auth_data</button>
        </div>
        <div>
            <button onclick="Step5()">第五步（获取auth_code）</button>
        </div>
        <div>
            <button onclick="GetOauth2bycode()">用auth_code获取token和sessionid</button>
        </div>
        <div>
            <button onclick="Getauth_codebytoken()">用token获取auth_code</button>
        </div>
        <div>
            <button onclick="GetUserLoginstatus()">获取登录状态</button>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button onclick="Getemplist()" type="button" class="btn btn-primary">批量查询职员基础资料详情</button>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button onclick="Purchasereceipt()" type="button" class="btn btn-primary">新增外购入库单</button>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button onclick="GetItemInfo()" type="button" class="btn btn-primary">查物料详细信息</button>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button onclick="GetMeasureUnit()" type="button" class="btn btn-primary">查询计量单位</button>
            </div>
        </div>
    </div>
</main>
<script type="text/javascript">
    function Step1() {
        $.ajax({
            url: '/Home/Getaaa',
            type: 'POST',
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Step2() {
        $.ajax({
            url: '/Home/Getbbb',
            type: 'POST',
            data: { code: $("#code").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Step3() {
        debugger;
        var session_id = $("#session_id").val();
        var session_secret = $("#session_secret").val();
        var access_token = $("#access_token").val();
        $.ajax({
            url: '/Home/Getccc',
            type: 'POST',
            data: { session_id: session_id, session_secret: session_secret, access_token: access_token },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Step4() {
        $.ajax({
            url: '/Home/Getddd',
            type: 'POST',
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Stepeee() {
        $.ajax({
            url: '/Home/Geteee',
            type: 'POST',
            data: { session_id: $("#session_id").val(), session_secret: $("#session_secret").val(), access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                var jsonObj = JSON.parse(data.Message);
                $("#authdata").val(jsonObj.data.auth_data);
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Step5() {
        $.ajax({
            url: '/Home/Getfff',
            type: 'POST',
            data: { access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                var jsonObj = JSON.parse(data.Message);
                $("#auth_code").val(jsonObj.data.auth_code);
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Step6() {
        $.ajax({
            url: '/Home/Getggg',
            type: 'POST',
            data: { auth_code: $("#auth_code").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function GetOauth2bycode() {
        $.ajax({
            url: '/Home/GetOauth2bycode',
            type: 'POST',
            data: { auth_code: $("#auth_code").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                var jsonObj = JSON.parse(data.Message);
                $("#session_id").val(jsonObj.data.session_id);
                $("#session_secret").val(jsonObj.data.session_secret);
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Getauth_codebytoken() {
        $.ajax({
            url: '/Home/Getauth_codebytoken',
            type: 'POST',
            data: { token: $("#auth_code").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function GetUserLoginstatus() {
        $.ajax({
            url: '/Home/GetUserLoginstatus',
            type: 'POST',
            data: { access_token: $("#access_token").val(), session_id: $("#session_id").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Getemplist() {
        $.ajax({
            url: '/Home/GetempList',
            type: 'POST',
            data: { authdata: $("#authdata").val(), access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function GetItemInfo() {
        $.ajax({
            url: '/Home/GetItemInfo',
            type: 'POST',
            data: { authdata: $("#authdata").val(), access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function GetMeasureUnit() {
        $.ajax({
            url: '/Home/GetMeasureUnit',
            type: 'POST',
            data: { authdata: $("#authdata").val(), access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Purchasereceipt() {
        $.ajax({
            url: '/Home/Purchasereceipt',
            type: 'POST',
            data: { authdata: $("#authdata").val(), access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
    function Getempinfo() {
        $.ajax({
            url: '/Home/GetempInfo',
            type: 'POST',
            data: { authdata: $("#authdata").val(), access_token: $("#access_token").val() },
            dataType: 'json',
            success: function (data) {
                debugger
                console.log('提交成功:', data);
            },
            error: function (xhr, status, error) {
                debugger
                console.error('提交失败:', error);
            }
        });
    }
</script>